/**
 * 
 */
package t4j.polymorphism;

/**
 * @author sz
 *
 * create time：2012-9-6
 */
class Glyph{
	void draw(){	
		System.out.println("Glyph.draw()");
	}
	
	Glyph(){
		System.out.println("Glyph() before draw()");
		
		System.out.println(this);
			this.draw();
		System.out.println("Glyph after draw()");
	} 
	
	public String toString(){  return "Glyph";}
}

class RoundGlyph extends Glyph{
	private int radius = 1;
	
	RoundGlyph(int r){
		radius = r ;
		System.out.println("RoundGlyph.RoundGlyph(), radius = " + radius);
	}
	
	void draw(){
		System.out.println("RoundGlyph.draw(),radius = "+radius);
	}
	
	public String toString(){  return "RoundGlyph";}
	
	public void delete(){
		System.out.println("delete");
	}
}


public class PolyConstructors {
   public static void main(String[] args) {
	   Glyph g = new RoundGlyph(5);
	  ( (RoundGlyph)g).delete();
}
}
